package com.kyzh.core.current

import com.gushenge.core.base.Base
import com.gushenge.core.beans.Code
import com.gushenge.core.dao.MMKVConsts
import com.gushenge.core.toast
import com.rxlife.coroutine.RxLifeScope
import rxhttp.toClass
import rxhttp.wrapper.param.RxHttp

/**
 *
 * @Author:         yu
 * @CreateDate:     2021/8/5 14:06
 */
object AppImpl {
    fun getMainDialog(listener: MainDialogInfo?. () -> Unit) {
        RxLifeScope().launch {
            val result = RxHttp.get("${Base.BASEURLV3}/?ct=app&ac=pop")

                .add("member_id", MMKVConsts.sub)
                .toClass<Code<MainDialogInfo>>()
                .await()

            if(result.code==1)
                listener(result.data)
//            else
//                result.message?.toast()
        }
    }
}